<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/whatwg/html/issues/6040">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div style="height:2000px">spacer</div>

<div id=wrapper hidden=until-found>
  <div id=target>target</div>
</div>

<script>
async_test(t => {
  assert_equals(wrapper.getAttribute('hidden'), 'until-found');
  assert_equals(window.pageYOffset, 0,
    `The page should be scrolled to the top at the start of the test.`);

  window.location.hash = '#target';

  requestAnimationFrame(t.step_func_done(() => {
    assert_false(wrapper.hasAttribute('hidden'),
      `Fragment navigation should remove the hidden attribute for hidden=until-found.`);
    assert_not_equals(window.pageYOffset, 0,
      `The page should be scrolled down to the target element.`);
  }));
}, `hidden=until-found content should be revealed in response to fragment navigation.`);
</script>
